package days48;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class day44 {
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String str = scanner.nextLine();
            StringBuilder stringBuilder = new StringBuilder(str);
            for (int i = 0; i < stringBuilder.length(); i++) {
                if(stringBuilder.charAt(i) == '_'){
                    char a = (char) (stringBuilder.charAt(i+1) -32);
                    stringBuilder.replace(i,i+2,a+"");
                }
            }
            System.out.println(stringBuilder);
        }
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String string = scanner.nextLine();
        String[] strings = string.split(" ");
        for (int i = strings.length-1; i>=0 ; i--) {
            System.out.print(strings[i]+" ");
        }
    }

    public static String addBinary(String a, String b) {
        StringBuilder ans = new StringBuilder();

        int n = Math.max(a.length(),b.length());
        int carry = 0;
        for (int i = 0; i < n; i++) {
            carry += i < a.length() ? (a.charAt(a.length() - 1 - i) - '0') : 0;
            carry += i < b.length() ? (b.charAt(b.length() - 1 - i) - '0') : 0;
            ans.append((char) (carry % 2 + '0'));
            //保留进位
            carry /= 2;
        }

        if(carry>0){
            ans.append('1');
        }

        ans.reverse();

        return ans.toString();
    }

    public static void main4(String[] args) {
        day44.addBinary("11","10");
    }
    public int[] countBits(int n) {
        int[] arr = new int[n+1];
        for (int i = 0; i <= n; i++) {
            arr[i] =count(i);
        }
        return arr;
    }

    private int count(int i) {
        int count =0;
        while (i>1){
            i&=(i-1);
            count++;
        }
        return count;
    }
    public int singleNumber(int[] nums) {
        Map<Integer,Integer> map = new HashMap<>();
        for (int k :nums) {
            if(map.get(k)==null){
                map.put(k,1);
                continue;
            }
            map.put(k,map.get(k)+1);
        }
        int y=0;
        for (Map.Entry<Integer,Integer> k :map.entrySet()) {
            int z = k.getValue(),x =k.getKey();
            if(z == 1){
                y= x;
                break;
            }

        }
        return y;
    }

    static class Person{
        int age;
        String name;

        public Person(int age, String name) {
            this.age = age;
            this.name = name;
        }
    }
    /**
     * 流的创建
     */
    public static void main5(String[] args) {
        int arr[] = {1,2,3};

        //通过Arrays.stream()创建
        IntStream intStream= Arrays.stream(arr);
        Person[] personStr = {new Person(18, "xiaoliu"), new Person(18, "xiaojing")};
        Stream<Person> personStream = Arrays.stream(personStr);
        //通过Stream.of来进行创建
        Stream<Integer> integerStream = Stream.of(1,2,3);
        //通过集合创建
        List<String> stringList = Arrays.asList("123","234","345");
        List<int[]> integerList= Arrays.asList(arr);
        Stream<String> stringStream = stringList.stream();

    }
    /**
     * 流的使用
     */
    public static void main3(String[] args) {
        List<Integer> list = Arrays.asList(1,1,1,4,5,6);
        //筛选出大于4的元素
        List<Integer> list1 = list.stream().filter(x->x>4).collect(Collectors.toList());
        System.out.println(list1.size());
        //集合中去重
        List<Integer> list2 = list.stream().distinct().collect(Collectors.toList());
        System.out.println(list2);
        //获取流中的第一个对象
        Optional<Integer> optionalInteger= list.stream().filter(x->x>4).findFirst();
        Optional<Integer> optionalInteger1= list.stream().filter(x->x>4).findAny();
        System.out.println(optionalInteger);
        System.out.println(optionalInteger1);
    }
    /**
     * collect的使用
     */
    public static void main6(String[] args) {
        ArrayList<Person> personList = new ArrayList<>();
        personList.add(new Person(12,"xiao"));
        personList.add(new Person(20,"xiao"));
        personList.add(new Person(18,"xiao"));
        personList.stream().map(x->x.age).forEach(System.out::println);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            String A = scanner.nextLine();
            String[] strings = A.split(" ");
            if(strings[0].length()<strings[1].length()){
                System.out.println("No");
                break;
            }
            Map<Character,Integer> map = new HashMap<>();
            String string = strings[0];
            for (int i = 0; i < strings[0].length(); i++) {
                if(map.get(string.charAt(i))==null){
                    map.put(string.charAt(i),1);
                }else {
                    map.put(string.charAt(i),map.get(string.charAt(i))+1);
                }
            }
            int count =0;
            String string2 =strings[1];
            Set<Character> set = new HashSet<>();
            boolean k =true;
            for (int i = 0; i < string2.length(); i++) {
                if(set.contains(string2.charAt(i))){
                    continue;
                }else {
                    set.add(string2.charAt(i));
                }
                if(map.get(string2.charAt(i))==null){
                    System.out.println("No");
                    k=false;
                    break;
                }
                count+= map.get(string2.charAt(i));
            }
            if (count>=string2.length()&&k){
                System.out.println("Yes");
            }else if(count<string2.length()&&k){
                System.out.println("No");
            }
        }
    }
}
